<template>
  <div class="dialog">
    <el-dialog
      :title="title"
      :visible.sync="visible"
      :close-on-click-modal="false"
      width="45%"
      top="20vh"
      @opened="init"
      @close="closeDialog"
    >
      <el-form
        :model="createForm"
        label-width="160px"
        label-suffix=":"
        class="searchw"
        ref="createForm"
      >
        <el-row :gutter="24">
          <el-col :span="22">
            <el-form-item label="车系名称" prop="name">
              <el-input
                v-model.trim="createForm.name"
                placeholder="请输入车系名称"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24">
          <el-col :span="22">
            <el-form-item label="生产商" prop="makeName">
              <el-input
                v-model.trim="createForm.makeName"
                placeholder="请输入生产商"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24" v-if="title == '修改车系'">
          <el-col :span="22">
            <el-form-item label="品牌名称" prop="name">
              <el-input
                v-model.trim="createForm.name"
                placeholder="请输入品牌字母"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24" v-if="title == '修改车系'">
          <el-col :span="22">
            <el-form-item label="采集时间" prop="gatherTime">
              <el-input
                v-model.trim="createForm.gatherTime"
                disabled
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="closeDialog()">关 闭</el-button>
        <el-button type="primary" @click="confirmData()">保 存</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
export default {
  name: 'addBrand',
  props: {
    row: {
      type: Object,
      default: {}
    },
    title: {
      type: String,
      default: ''
    },
    value: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      visible: true,
      createForm: {
        name: '',
        initial: '',
        gatherTime: ''
      }
    }
  },
  created() {
    // this.createForm = row;
  },
  mounted() {},
  methods: {
    init() {
      if(this.row.id){
       this.createForm = this.row
      }
    },
    confirmData() {
      this.$emit('ok', this.createForm)
    },
    closeDialog() {
      this.$emit('cancle')
    }
  }
}
</script>
<style scoped lang="less"></style>
